export default async function (app) {
    const { store, route, redirect, params, query, req, res, $cookies } = app;

    if (route.meta.some(item => item.isLogin)) {
        if ($cookies.get("userInfo")) {
            if (Object.keys($cookies.get("userInfo")).length == 0) {
                redirect('/login')
                return;
            }
        } else {
            redirect('/login')
            return;
        }
    }
    if (route.meta.some(item => item.title)) {
        route.meta.forEach(item => {
            store.commit('setHeadTitle', item.title)
        })
    } else {
        store.commit('setHeadTitle', '萌绘')
    }
    store.commit('getUserInfo', app);
    store.commit('CloseNav');
    if (route.name != 'contentarticle') {
        await store.dispatch('handleSetActiveArr', { path: route.path, app })
    }
    $cookies.set('activePage', 0)
    store.commit('changePage', app);



}